﻿using System;
using System.Xml;

namespace MyGroups.Model
{
    
    public abstract class BaseXmlReader
    {

        #region "  Private Methods  "

        protected string GetNodeAttributeText(XmlNode xmlNode, string xpath)
        {
            return GetNodeAttributeText(xmlNode.SelectSingleNode(xpath));
        }

        protected string GetNodeAttributeText(XmlNode xmlNode)
        {
            if (xmlNode != null)
            {
                return xmlNode.Value;
            }
            else
            {
                return String.Empty;
            }
        }

        protected string GetNodeInnerText(XmlNode xmlNode, string xpath)
        {
            return GetNodeInnerText(xmlNode.SelectSingleNode(xpath));
        }

        protected string GetNodeInnerText(XmlNode xmlNode)
        {
            if (xmlNode != null)
            {
                return xmlNode.InnerText;
            }
            else
            {
                return String.Empty;
            }
        }

        #endregion

    }

}
